package com.spring.cloud.microservice_feign80.controller;

import com.spring.api.entities.Dept;
import com.spring.api.service.ConsumerClientService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class ConsumerController {
    @Resource
    private ConsumerClientService consumerClientService;

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return consumerClientService.get(id);
    }

    /**
     * 客户端请求的地址
     *
     * @return
     */
    @RequestMapping("/consumer/dept/findAll")
    public List<Dept> list() {
        return consumerClientService.findAll();
    }
}
